package pl.edu.agh.agents.gui.actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import com.mxgraph.layout.mxOrganicLayout;

import pl.edu.agh.agents.gui.GUI;

public class LayoutAction extends AbstractAction {
	private static final long serialVersionUID = 6121267254710416663L;
	
	private GUI gui;
	
	public LayoutAction(String name, GUI gui) {
		super(name);
		
		this.gui = gui;
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		mxOrganicLayout layout = new mxOrganicLayout(gui.getGraph());
		
		layout.execute(gui.getGraph().getDefaultParent());
	}
}